package com.dubito.dao;

import org.mybatis.spring.SqlSessionTemplate;
import org.springframework.beans.factory.annotation.Autowired;

public abstract class BaseDao<T> {

	
	@Autowired
	private SqlSessionTemplate sqlSessionTemplate;
	
	public String getStatement(String sqlId){
		
		String name = this.getClass().getName();
		
		StringBuilder sb = new StringBuilder();
		
		sb.append(name+"."+sqlId);
		
		return sb.toString();
	}
	
	public T select(Integer id){
		
		return sqlSessionTemplate.selectOne(getStatement("select"), id);
	}
	
}
